package com.uvnos4j.matilda.commons.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

/**
 * Swagger 配置类
 *
 * @author Guo.wl
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket docker() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .groupName("DEFAULT")
                .enable(true)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.uvnos4j.matilda"))
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfo(
                "Matilda Boot",
                "企业级快速开发平台",
                "1.0.0",
                "http://39.107.127.152/",
                new Contact("小郭大侠", "https://section2014.github.io/", "1060702785@qq.com"),
                "apache",
                "",
                new ArrayList<>()
        );
    }
}